package main

import (
	"github.com/gin-gonic/gin"
	"log"
	"main/src/apps"
	"main/src/configs"
	"main/src/middlewares"
	"main/src/route"
	"main/src/utils"
)

func main() {
	if err := utils.InitTrans("zh"); err != nil {
		log.Println("初始化翻译器错误")
		return
	}
	r := gin.Default()
	r.LoadHTMLGlob("templates/*")
	r.Use(middlewares.Cors())

	r.Use(middlewares.JWTAuth())
	err := apps.ConnectToCluster()
	if err != nil {
		panic(err)
	}
	route.InitRoute(r)
	r.Run(configs.Config.ServerAddress) // 监听并在 0.0.0.0:8080 上启动服务

}
